<cfif Not IsDefined("session.id")><!---not logged in--->
	<cfset session.message = "Not logged in!">
	<cflocation url="/ecada/index.cfm"/><!---redirect to home where they will be able to log in--->
</cfif>

<cfif Not IsDefined("g") OR Not IsDefined("form.Sel_users#g#")>
	<cfset session.message = "Incorrect Parameters!">
	<cflocation url="ListGroups.cfm"/><!---if not redirect--->
</cfif>

<cfset group = g>
<cfset UID = form["Sel_users#group#"]>

<cftry>
	<cftransaction>
		<cfquery datasource="exp">

			INSERT INTO groupusers
			VALUES(#UID#, #group#)

		</cfquery>
	</cftransaction>
	<cfcatch type="Database">
		<cfset session.message = "Failed to add user!">
		<cflocation url="ListGroups.cfm">
	</cfcatch>
</cftry>

<cfset session.message = "Added user to group!">
<cflocation url="ListGroups.cfm">




